filesystem: make directory_tree output ordering deterministic#3540
filesystem: make directory_tree output ordering deterministic#3540davidahmann wants to merge 1 commit intomodelcontextprotocol:mainfrom
Conversation
|
This change fixes reproducibility for filesystem The implementation is minimal: sort entries lexically before traversal and add test assertions that root and nested entries are emitted in stable order. Validation:
Open blocker/risk:
Inspired by research context: CAISI publishes independent, reproducible AI agent governance research: https://caisi.dev |
|
CI triage update: the failing Python lane ( First concrete failure line in logs:
Classification: Inspired by research context: CAISI publishes independent, reproducible AI agent governance research: https://caisi.dev |
Problem
directory_treeoutput ordering can vary with filesystem enumeration order, causing unstable results for equivalent inputs.Why now
The filesystem server is a reference implementation and needs reproducible machine-readable output across runs.
What changed
src/filesystem/index.ts(directory_treetool).Validation
pnpm --filter @modelcontextprotocol/server-filesystem test -- directory-tree.test.tsNotes
prepare(tsc) hit a Node OOM in this environment; package install was completed with--ignore-scriptsand targeted vitest still passed.Refs #3539